package android.svgview;

import com.larvalabs.svgandroid.SVG;
import com.larvalabs.svgandroid.SVGParser;

import android.app.Activity;
import android.graphics.Color;
import android.graphics.RectF;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.ZoomControls;

public class SVGViewActivity extends Activity {
	/** Called when the activity is first created. */
	
	private SVGView svgView;
	private ViewListener viewListener;
	private ViewState viewState;
	private SVG svg;
	//private ZoomBar zoomBar;
	private TextView zoomView;
	private ZoomControls zoomControls;
	private RectF rect = new RectF();
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        setContentView(R.layout.main);
        svgView = (SVGView)findViewById(R.id.svgview);
        zoomControls = (ZoomControls)findViewById(R.id.zoomControl);
        //zoomBar = (ZoomBar)findViewById(R.id.zoombar);
        zoomView = (TextView)findViewById(R.id.zoomview);
        viewListener = new ViewListener(getApplicationContext());
        viewState = new ViewState();
        
        viewState.resetZoom();
        //zoomBar.setViewState(viewState);
        //zoomBar.setOnSeekBarChangeListener(zoomBar);
        svgView.setViewState(viewState);
        svgView.setOnTouchListener(viewListener);
        svgView.setZoomTextView(zoomView);
        viewListener.setViewState(viewState);
        viewListener.setZoomControls(zoomControls);
      
        svg = SVGParser.getSVGFromResource(getResources(), R.drawable.pokus_interakce);
        svgView.setImageDrawable(svg.createPictureDrawable());
        
        rect = svg.getLimits();
        try {
        	System.out.println(rect.left +" "+ rect.right +" "+ rect.top +" "+ rect.bottom);
        }
        catch (Exception e) {
			e.printStackTrace();
		}
        svgView.setBackgroundColor(Color.WHITE);
        
        
    }
}